home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / lib / python2.6 / user.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-11-11  |  2KB  |  52 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. """Hook to allow user-specified customization code to run.
  5.  
  6. As a policy, Python doesn't run user-specified code on startup of
  7. Python programs (interactive sessions execute the script specified in
  8. the PYTHONSTARTUP environment variable if it exists).
  9.  
  10. However, some programs or sites may find it convenient to allow users
  11. to have a standard customization file, which gets run when a program
  12. requests it.  This module implements such a mechanism.  A program
  13. that wishes to use the mechanism must execute the statement
  14.  
  15.     import user
  16.  
  17. The user module looks for a file .pythonrc.py in the user's home
  18. directory and if it can be opened, execfile()s it in its own global
  19. namespace.  Errors during this phase are not caught; that's up to the
  20. program that imports the user module, if it wishes.
  21.  
  22. The user's .pythonrc.py could conceivably test for sys.version if it
  23. wishes to do different things depending on the Python version.
  24.  
  25. """
  26. from warnings import warnpy3k
  27. warnpy3k('the user module has been removed in Python 3.0', stacklevel = 2)
  28. del warnpy3k
  29. import os
  30. home = os.curdir
  31. if 'HOME' in os.environ:
  32.     home = os.environ['HOME']
  33. elif os.name == 'posix':
  34.     home = os.path.expanduser('~/')
  35. elif os.name == 'nt':
  36.     if 'HOMEPATH' in os.environ:
  37.         if 'HOMEDRIVE' in os.environ:
  38.             home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
  39.         else:
  40.             home = os.environ['HOMEPATH']
  41.     
  42.  
  43. pythonrc = os.path.join(home, '.pythonrc.py')
  44.  
  45. try:
  46.     f = open(pythonrc)
  47. except IOError:
  48.     pass
  49.  
  50. f.close()
  51. execfile(pythonrc)
  52.